//
// Created by PanCheng on 16/03/2017.
//

#ifndef FACETRACKHANDLE_H
#define FACETRACKHANDLE_H


#include "platform.h"
#if NCNN_OPENCV
#include "opencv.h"
#else
#include <opencv2/core/core.hpp>
#endif

#include "YTFaceTrackPro.h"
#include "faceshapestablizer.h"


struct FaceStatus
{
    bool valid;
    TC_FaceShape shape;
    cv::Rect rect;
    float score;
    FaceShapeStablizer stablizer;
};


class FaceTracker
{
public:

    void track(const cv::Mat& rgb);

    void track(const cv::Mat& rgb, const std::vector<cv::Rect>& detected_faces);

    bool face_valid(const FaceStatus& face) const;

public:
    std::vector<FaceStatus> faces;
};





class FaceTrack
{
public:
    FaceTrack();
    ~FaceTrack();
    int detect_face(const cv::Mat& rgb, std::vector<cv::Rect>& faces);

    int detect_face_with_mask(const cv::Mat& rgb, std::vector<FaceStatus>& trackerfaces, std::vector<cv::Rect>& faces);

    int detect_faceshape(const cv::Mat& rgb, std::vector<TC_FaceShape>& shapes);


private:
    FaceTracker tracker;
    int force_facedetect;
};









#endif